<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="w" %>

<div class="easyui-layout" fit="true">
    <div data-options="region:'center'">
        <form id="flooritemForm" action="/floor/UiFloorProductPage@execute.page" method="post">
            <!-- 操作区域 -->
            <div class="easyui-panel ui-toolBar" border="false" data-options="doSize:false">
                <a href="javascript:;" class="easyui-linkbutton" plain="true"
                   onclick="addPanelItem(<w:write bind="bean.panelId"/>)"
                   style="width:50px;">添加</a>
                <a href="javascript:;" class="easyui-linkbutton" plain="true" onclick="delPanelItem()"
                   style="width:50px;">删除</a>
            </div>
            <div class="ui_line" style="margin-top:10px"></div>
            <!-- 数据列表区域 -->
            <table class="ui-table" width="100%" cellpadding="1" cellspacing="1" data-options="showPage:false">
                <w:hidden bind="bean.panelId"/>
                <thead>
                <tr class="ui_th">
                    <td width="35" align="center"><input type="checkbox" onclick="$selAllTbBoxs(this)"></td>
                    <td width="50">ID</td>
                    <td>类目名称</td>
                    <td>链接网址</td>
                    <td>类目样式</td>
                    <td>创建时间</td>
                    <td>备注</td>
                    <td width="130" align="center">操作</td>
                </tr>
                </thead>
                <tbody>
                <w:iterate id="info" bind="resultList_">
                    <tr class="ui_td">
                        <td width="35" align="center"><input type="checkbox" name="primaryKey_"
                                                             value="<w:write bind="#info.id"/>"></td>
                        <td><w:write bind="#info.id"/></td>
                        <td><w:write bind="#info.title"/></td>
                        <td><w:write bind="#info.link"/></td>
                        <td><w:write bind="#info.css"/></td>
                        <td><w:write bind="#info.create_time"/></td>
                        <td><w:write bind="#info.remark"/></td>
                        <td align="center">
                            <a href="javascript:;" class="ui_btn marginR8"
                               onclick="editPanelItem(<w:write bind="#info.id"/>)">修改</a>
                        </td>
                    </tr>
                </w:iterate>
                </tbody>
            </table>
        </form>
    </div>
</div>
<script>
    function addPanelItem(id) {
        $w.openDialog({
            url: ctx + '/floor/UiFloorProductPage@show.page?bean.ui_floor_panel_id=' + id,
            title: "添加面板类目 ",
            w: 820,
            h: 520,
            afterClose: function (re) {
                if (re) {
                    query();
                }
            }
        });
    }
    function editPanelItem(id) {
        $w.openDialog({
            url: ctx + '/floor/UiFloorProductPage@show.page?bean.id=' + id,
            title: "编辑面板类目 ",
            w: 820,
            h: 520,
            afterClose: function (re) {
                if (re) {
                    query();
                }
            }
        });
    }
    function delPanelItem() {
        var ids = $("tbody").find("[name='primaryKey_']:checked").map(function () {
            return $(this).val();
        }).get();
        if (ids.length <= 0) {
            alert("请选择类目");
            return false;
        }
        window.parent.$w.confirmMsg("确定删除？", function (r) {
            if (r) {
                $w.doUrl(ctx + "/floor/item", {"_method": "DELETE", "ids": ids}, function (json) {
                    query();
                })
            }
        })
    }
    function query() {
        $w.execForm({form: $('#flooritemForm')});
        $w.listFlesh = true;
    }
</script>
